package puzzle.masyu2.solver;

import puzzle.common.data.HatanException;
import puzzle.masyu2.data.MasyuBoard;

abstract class MasyuCellRule implements MasyuBoardRule {
	public boolean apply(MasyuBoard b) throws HatanException {
		boolean isChanged = false;
		for (int y = 0; y < b.height; y++) {
			for (int x = 0; x < b.width; x++) {
				if (b.isDirty(x, y)) {
					isChanged |= apply(b, x, y);
				}
			}
		}
		return isChanged;
	}

	public abstract boolean apply(MasyuBoard b, int x, int y) throws HatanException;
}
